var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2AudioManager = require("AudioManager");
var $2DataManager = require("DataManager");
var $2GoldManager = require("GoldManager");
var $2SceneStage = require("SceneStage");
var $2KDefine = require("KDefine");
var $2MyUtils = require("MyUtils");
var d = cc._decorator.ccclass;
var def_Gold = /* */function (_cc$Component27) {
  babel_inherits(h, _cc$Component27);
  var _super30 = babel_createSuper(h);
  function h() {
    var _this62;
    babel_classCallCheck(this, h);
    _this62 = _super30.apply(this, arguments);
    _this62.gold = 50;
    return _this62;
  }
  babel_createClass(h, [{
    key: "init",
    value: function init(e, t, a, n) {
      var _this63 = this;
      this.node.x = e;
      this.node.y = t;
      this.node.zIndex = 999;
      var i = $2MyUtils.MyUtils.getRandomInt(-1, 2);
      this.gold = Math.floor(n);
      var r = cc.tween;
      r(this.node).parallel(r().by(.25, {
        x: 50 * i
      }), r().by(.25, {
        y: 50
      }).to((t + 30 - $2DataManager.default.instance.groudYArr[a]) / 200, {
        y: $2DataManager.default.instance.groudYArr[a] - 30
      })).call(function () {
        $2SceneStage.default.instance.autoPick && _this63.scheduleOnce(function () {
          _this63.onClickGold();
        }, .5);
        _this63.scheduleOnce(function () {
          $2GoldManager.default.instance.putItem(_this63.node);
        }, 10);
      }).start();
      this.node.on(cc.Node.EventType.TOUCH_END, this.onClickGold, this);
    }
  }, {
    key: "onClickGold",
    value: function onClickGold() {
      var _this64 = this;
      this.unscheduleAllCallbacks();
      $2AudioManager.default.instance.playEffect($2KDefine.AudioName.PickSunEff);
      var e = $2MyUtils.MyUtils.getDis(214, 316, this.node.x, this.node.y);
      cc.tween(this.node).to(e / 1e3, {
        x: -515,
        y: 310
      }).call(function () {
        $2GoldManager.default.instance.putItem(_this64.node);
        $2SceneStage.default.instance.goldNums += _this64.gold;
      }).start();
    }
  }, {
    key: "onDisable",
    value: function onDisable() {
      cc.Tween.stopAllByTarget(this.node);
    }
  }]);
  return h;
}(cc.Component);
def_Gold = cc__decorate([d], def_Gold);
exports.default = def_Gold;